//package thread;
//
//import java.util.concurrent.LinkedBlockingQueue;
//import java.util.concurrent.ThreadPoolExecutor;
//import java.util.concurrent.TimeUnit;
//
///**
// * @program: thread
// * @description:
// * @author: gongj
// * @Description: TODO
// * @create: 2020-07-07 19:49
// **/
//public class ThreadPoolExecutorTest {
//    public static void main(String[] args) {
//        ThreadPoolExecutor executor =
//                new ThreadPoolExecutor(1, 2, 1, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(2));
//        executor.execute(new TestThread());
//        executor.execute(new TestThread());
//        executor.execute(new TestThread());
//        executor.execute(new TestThread());
//        //执行第五个任务就会发生异常
//        executor.execute(new TestThread());
//        //关闭线程池
//        executor.shutdown();
//    }
//}
//class TestThread implements  Runnable {
//    @Override
//    public void run() {
//        System.out.println(Thread.currentThread().getName());
//    }
//}